# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=cycfx2prog
pkgver=0.47
pkgrel=4
pkgdesc='CycFX2Prog is a small and useful tool to program the FX2 and do basic enpoint communication for testing purposes'
arch=(loong64 x86_64)
url='https://www.triplespark.net/elec/periph/USB-FX2/software/'
license=(GPL2)
depends=(
  glibc
  libusb-compat
)
source=(
  $url/$pkgname-$pkgver.tar.gz
  $pkgname-0.47-makefile.patch
)
sha512sums=('089895f0c4b45012f9f9fc607a30c2e2897f360d270973354fa739cc456d2728080733461f6a3681422049599947461c05e5d9e7e598fc3c9fd6d5a7d89e346c'
            '432ae4cad8743efe527a38966e120466783fc3b4d9a797d2e2a2ff8382d7413c2d98952efda713f3c5cfa61afd75533beae98187017145aa518f30264e0262c3')
b2sums=('41fb12157cf03efed6ce40111bb6bef03c986828690b5f36b7250f9b00af3f1ac872703a8774b70353126a297f974964f55461d38eab2bada0754306433f20c7'
        '2cb1628cd69a16a2f8a2dcad74df566b121eb8872d3038a3a9dcf8a844cf1101ef65bb793cc98980cc75ba0bda13ea0a6567a58a54c583e6d2c6d39f2501d742')

prepare() {
  # honor distribution CFLAGS/LDFLAGS
  patch -Np1 -d $pkgname-$pkgver -i ../$pkgname-0.47-makefile.patch
}
build() {
  make -C $pkgname-$pkgver
}

package() {
  install -Dm 755 $pkgname-$pkgver/$pkgname -t "$pkgdir"/usr/bin/
}
